#ifndef _OPTOCOUNTER_H_
#define _OPTOCOUNTER_H_

#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
#include <boost/thread/mutex.hpp>
#include <sys/time.h>
#include <unistd.h>
#include <sched.h>

class OptoCounter
{
	protected:
		int m_GpioNumber;
		double m_FreqDiv;
		int m_GpioFd;

		boost::thread * m_CountingThread;

		void CountingThread();

		bool m_shallStop;

	public:

		double m_NbToursParSeconds;

		OptoCounter(int gpioNumber, double freqDiv);
		~OptoCounter();
		void Run();
		void Stop();
};

#endif